package com.sise.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;

public class AidlService extends Service {
    /* 声明Service实例*/
    private CaculateBinder calculateBinder;
    // 继承Stub，也就是实现额ICat接口，并实现了IBinder接口
    public class CaculateBinder extends ICaculate.Stub {
        @Override
        public int add(int a, int b) throws RemoteException
        {
            return a+b;
        }
    }
    @Override
    public void onCreate(){
        /* 创建Binder实例*/
        super.onCreate();
        calculateBinder=new CaculateBinder();
    }
    @Override
    public IBinder onBind(Intent arg0)	{
        /* 返回Binder对象*/
        return calculateBinder;
    }

}
